package com.example.ncov_management_system.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class RRExcetpionHandler {
    @ExceptionHandler(RRException.class)
    public ModelAndView exception(RRException e) {
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("msg");
        modelAndView.addObject("msg", e.getMessage());
        return modelAndView;
    }
//    @ExceptionHandler(RuntimeException.class)
//    public ModelAndView exception(RuntimeException e) {
//        ModelAndView modelAndView = new ModelAndView();
//        modelAndView.setViewName("msg");
//        modelAndView.addObject("msg", e.toString());
//        return modelAndView;
//    }
}
